package group.sicher.common.entity;

import group.sicher.common.constant.senum.OptionTypeEnum;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * @Auth rock
 * @Date 2019/7/1 21:08
 * @description
 */
@Entity
@Table(name = "wm_order_refund")
public class OrderRefundEntity {

    private Long id;
    private String orderCode;
    private Long userId;
    private String username;
    private BigDecimal payMoney;
    private String refundReason;
    private Long applyTime;
    private Integer serviceCost;
    private Long handleAt;
    private Long finishAt;
    private Integer status;//TODO 状态枚举
    private OptionTypeEnum optionType;
    private String optioner;

       @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "order_code", nullable = true, length = 50)
    public String getOrderCode() {
        return orderCode;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    @Basic
    @Column(name = "user_id", nullable = true)
    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "username", nullable = true, length = 20)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Basic
    @Column(name = "pay_money", nullable = true, precision = 0)
    public BigDecimal getPayMoney() {
        return payMoney;
    }

    public void setPayMoney(BigDecimal payMoney) {
        this.payMoney = payMoney;
    }

    @Basic
    @Column(name = "refund_reason", nullable = true, length = 500)
    public String getRefundReason() {
        return refundReason;
    }

    public void setRefundReason(String refundReason) {
        this.refundReason = refundReason;
    }

    @Basic
    @Column(name = "apply_time", nullable = true)
    public Long getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(Long applyTime) {
        this.applyTime = applyTime;
    }

    @Basic
    @Column(name = "service_cost", nullable = true, precision = 0)
    public Integer getServiceCost() {
        return serviceCost;
    }

    public void setServiceCost(Integer serviceCost) {
        this.serviceCost = serviceCost;
    }

    @Basic
    @Column(name = "handle_at", nullable = true)
    public Long getHandleAt() {
        return handleAt;
    }

    public void setHandleAt(Long handleAt) {
        this.handleAt = handleAt;
    }

    @Basic
    @Column(name = "finish_at", nullable = true)
    public Long getFinishAt() {
        return finishAt;
    }

    public void setFinishAt(Long finishAt) {
        this.finishAt = finishAt;
    }

    @Basic
    @Column(name = "status", nullable = true)
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "option_type", nullable = true)
    public OptionTypeEnum getOptionType() {
        return optionType;
    }

    public void setOptionType(OptionTypeEnum optionType) {
        this.optionType = optionType;
    }

    @Basic
    @Column(name = "optioner", nullable = true, length = 20)
    public String getOptioner() {
        return optioner;
    }

    public void setOptioner(String optioner) {
        this.optioner = optioner;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OrderRefundEntity that = (OrderRefundEntity) o;
        return id == that.id &&
                Objects.equals(orderCode, that.orderCode) &&
                Objects.equals(userId, that.userId) &&
                Objects.equals(username, that.username) &&
                Objects.equals(payMoney, that.payMoney) &&
                Objects.equals(refundReason, that.refundReason) &&
                Objects.equals(applyTime, that.applyTime) &&
                Objects.equals(serviceCost, that.serviceCost) &&
                Objects.equals(handleAt, that.handleAt) &&
                Objects.equals(finishAt, that.finishAt) &&
                Objects.equals(status, that.status) &&
                Objects.equals(optionType, that.optionType) &&
                Objects.equals(optioner, that.optioner);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, orderCode, userId, username, payMoney, refundReason, applyTime, serviceCost, handleAt, finishAt, status, optionType, optioner);
    }
}
